{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Creating the json file with the file names"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "from os import listdir\n",
    "from os.path import join\n",
    "import json\n",
    "validation_L = []\n",
    "root_data_dir = \"../../DataSet/ASNR-MICCAI-BraTS2023-Local-Synthesis-Challenge-Training\"\n",
    "for case in listdir(root_data_dir):\n",
    "    entry_case = {\n",
    "        \"mask_healthy\": f\"{root_data_dir}/{case}/{case}-mask-healthy.nii.gz\",\n",
    "        \"mask_unhealthy\": f\"{root_data_dir}/{case}/{case}-mask-unhealthy.nii.gz\",\n",
    "        \"mask\": f\"{root_data_dir}/{case}/{case}-mask.nii.gz\",\n",
    "        \"t1n_voided\": f\"{root_data_dir}/{case}/{case}-t1n-voided.nii.gz\",\n",
    "        \"t1n\": f\"{root_data_dir}/{case}/{case}-t1n.nii.gz\"\n",
    "        }\n",
    "\n",
    "    validation_L.append(entry_case)\n",
    "# Open the file for writing in text mode ('w')\n",
    "with open('./ASNR-MICCAI-BraTS2023-Local-Synthesis-Challenge-Training.json', 'w') as json_file:\n",
    "    json.dump({\"training\": validation_L}, json_file, indent=4)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "brats2023",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.1.undefined"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
